﻿using UnityEngine;
using UnityEngine.Experimental.Input;
using UnityEngine.UI;

public class Test01 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        inputManager.Enable();

        inputManager.Player.Shot.performed += ctx =>
        {
            Debug.Log("Shot performed.");
        };

        //inputManager.Player.Shot.started += ctx => {
        //    Debug.Log("Shot started.");
        //};

        //inputManager.Player.Shot.cancelled += ctx => {
        //    Debug.Log("Shot cancelled.");
        //};
    }

    Vector2 lookR, lookL;
    private void Update()
    {
        //var gamepad = Gamepad.current;
        //if (gamepad != null)
        //{
        //    lookR = gamepad.rightStick.ReadValue();
        //    textLookR.text = lookR.ToString();

        //    lookL = gamepad.leftStick.ReadValue();
        //    textLookL.text = lookL.ToString();
        //}

        //var keyboard = Keyboard.current;
        //if (keyboard.spaceKey.isPressed)
        //{
        //    Debug.Log("Space Key Pressed");
        //}

        //var mouse = Mouse.current;
        //if(mouse.leftButton.isPressed)
        //{
        //    Debug.Log("Mouse LeftButton Pressed.");
        //}

    }

    private void OnDestroy()
    {
        inputManager.Disable();
    }

    public InputManager inputManager;
    public Text textLookR;
    public Text textLookL;
}
